package com.example.fang.demodruid.concurrency7;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.IntStream;

public class Mytest1 {

/*    public static void main(String[] args) {
        ExecutorService executorService= Executors.newFixedThreadPool(3);
        //提交多个任务
        IntStream.range(0,10).forEach(j->{
            executorService.submit(()->{
                IntStream.range(0,50).forEach(i->{
                    System.out.println(Thread.currentThread().getName());
                });
            });
        });
        executorService.shutdown();//关闭线程池
    }*/

    public static void main(String[] args) {
        ExecutorService executorService= Executors.newFixedThreadPool(3);

        //提交多个任务
        IntStream.range(0,10).forEach(j->{
            int i=1;
            Future future= executorService.submit(()->{
                return  1;
            });
        });
        executorService.shutdown();//关闭线程池
    }
}
